/**********************************************************************************
Program:       chinaweathergadget

License:       GNU/GPL version 3

File:          GenerateResources.cs

Description:   用于生成资源文件，单独编译执行

Author:        Guangyu Liu （lgy0417@gmail.com）

Environment:   .NET Framework v2.0 or later version

Usage/Example: README_chs.txt

Last Modified: 2010.08.30

***********************************************************************************/


using System;
using System.IO;
using System.Drawing;
using System.Resources;


public class CreatePicResource
{

	static void Main()
	{
		int fileLength = 399;
		ResourceWriter rw = new ResourceWriter("ChinaWeatherGadget.resources");
		
		Icon _16_icon = new Icon(@"icon\16x16.ico");
		Image _48 = Image.FromFile(@"icon\48x48.ico");
		Image _add = Image.FromFile(@"icon\add.png");
		Image _delete = Image.FromFile(@"icon\delete.png");
		Image _edit = Image.FromFile(@"icon\edit.png");
		Image _ok = Image.FromFile(@"icon\ok.png");
		Image _cancel = Image.FromFile(@"icon\cancel.png");
		Image _close = Image.FromFile(@"icon\close.png");
		Image _up = Image.FromFile(@"icon\up.png");
		Image _down = Image.FromFile(@"icon\down.png");
		Image _refresh = Image.FromFile(@"icon\refresh.png");
		
		string buildTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm");
		Console.WriteLine("Build Time: " + buildTime + Environment.NewLine);
		
		rw.AddResource("16x16_icon", _16_icon);
		rw.AddResource("48x48", _48);
		rw.AddResource("add_png", _add);
		rw.AddResource("delete_png", _delete);
		rw.AddResource("edit_png", _edit);
		rw.AddResource("ok_png", _ok);
		rw.AddResource("cancel_png", _cancel);
		rw.AddResource("close_png", _close);
		rw.AddResource("up_png", _up);
		rw.AddResource("down_png", _down);
		rw.AddResource("refresh_png", _refresh);
		rw.AddResource("BuildTime", buildTime);
		
		using(StreamReader sr = new StreamReader(@"ID.dat"))
		{
			string line;
			for(int i = 0; i < fileLength; i++)
			{
				line = sr.ReadLine();
				rw.AddResource("DataLine" + i.ToString(), line);
			}
		}
		
		rw.Generate();
		rw.Close();
	}
}